////////////////////////////////////////////////////////////////////////////////
/// Midnight Circus 2007
////////////////////////////////////////////////////////////////////////////////

namespace GatherTogether
{
    sealed class GatherConstants
    {
        /// <summary>
        /// Kalimdor, Eastern Kingdoms, Outlands
        /// </summary>
        public const int NumberOfContinents = 3;

        /// <summary>
        /// names of possible zones across all continents
        /// </summary>
        public enum MapZone
        {
            Unknown,
            //Kalimdor
            Ashenvale,
            Azshara,
            AzuremystIsle,
            Barrens,
            BloodmystIsle,
            Darkshore,
            Darnassus,
            Desolace,
            Durotar,
            Dustwallow,
            Exodar,
            Felwood,
            Feralas,
            Moonglade,
            Mulgore,
            Ogrimmar,
            Silithus,
            Stonetalon,
            Tanaris,
            Teldrassil,
            ThousandNeedles,
            ThunderBluff,
            Ungoro,
            Winterspring,
            //Eastern Kingdoms
            Alterac,
            Arathi,
            Badlands,
            BlastedLands,
            BurningSteppes,
            DeadwindPass,
            DunMorogh,
            Duskwood,
            EasternPlaguelands,
            Elwynn,
            EversongWoods,
            Ghostlands,
            Hilsbrad,
            Hinterlands,
            Ironforge,
            LochModan,
            Redridge,
            SearingGorge,
            Silvermoon,
            Silverpine,
            Stormwind,
            Stranglethorn,
            SwampOfSorrows,
            Tirisfal,
            Undercity,
            WesternPlaguelands,
            Westfall,
            Wetlands,
            //Outland
            BladesEdge,
            Hellfire,
            Nagrand,
            Netherstorm,
            Shadowmoon,
            Shattrath,
            Terokkar,
            Zangarmarsh
        }

        /// <summary>
        /// A static helper class used to convert between the string names of each zone
        /// and the enum assigned to a zone.
        /// </summary>
        static public class AreaName
        {
            private static MatchedPair<string, MapZone> m_zones = new MatchedPair<string, MapZone>();

            /// <summary>
            /// A static constructor that constructs the mappings of area names to zones, and vice versa
            /// </summary>
            static AreaName()
            {
                // Kalimdor
                m_zones.AddPair("ASHENVALE", MapZone.Ashenvale);
                m_zones.AddPair("AZSHARA", MapZone.Azshara);
                m_zones.AddPair("AZUREMYST_ISLE", MapZone.AzuremystIsle);
                m_zones.AddPair("BARRENS", MapZone.Barrens);
                m_zones.AddPair("BLOODMYST_ISLE", MapZone.BloodmystIsle);
                m_zones.AddPair("DARKSHORE", MapZone.Darkshore);
                m_zones.AddPair("DESOLACE", MapZone.Desolace);
                m_zones.AddPair("DUROTAR", MapZone.Durotar);
                m_zones.AddPair("DUSTWALLOW_MARSH", MapZone.Dustwallow);
                m_zones.AddPair("EXODAR", MapZone.Exodar);
                m_zones.AddPair("FELWOOD", MapZone.Felwood);
                m_zones.AddPair("FERALAS", MapZone.Feralas);
                m_zones.AddPair("MOONGLADE", MapZone.Moonglade);
                m_zones.AddPair("MULGORE", MapZone.Mulgore);
                m_zones.AddPair("ORGRIMMAR", MapZone.Ogrimmar);
                m_zones.AddPair("SILITHUS", MapZone.Silithus);
                m_zones.AddPair("STONETALON_MOUNTAINS", MapZone.Stonetalon);
                m_zones.AddPair("TANARIS", MapZone.Tanaris);
                m_zones.AddPair("TELDRASSIL", MapZone.Teldrassil);
                m_zones.AddPair("THOUSAND_NEEDLES", MapZone.ThousandNeedles);
                m_zones.AddPair("THUNDER_BLUFF", MapZone.ThunderBluff);
                m_zones.AddPair("UNGORO_CRATER", MapZone.Ungoro);
                m_zones.AddPair("WINTERSPRING", MapZone.Winterspring);
                // Eastern Kingdoms
                m_zones.AddPair("ALTERAC_MOUNTAINS", MapZone.Alterac);
                m_zones.AddPair("ARATHI_HIGHLANDS", MapZone.Arathi);
                m_zones.AddPair("BADLANDS", MapZone.Badlands);
                m_zones.AddPair("BLASTED_LANDS", MapZone.BlastedLands);
                m_zones.AddPair("BURNING_STEPPES", MapZone.BurningSteppes);
                m_zones.AddPair("DEADWIND_PASS", MapZone.DeadwindPass);
                m_zones.AddPair("DUN_MOROGH", MapZone.DunMorogh);
                m_zones.AddPair("DUSKWOOD", MapZone.Duskwood);
                m_zones.AddPair("EASTERN_PLAGUELANDS", MapZone.EasternPlaguelands);
                m_zones.AddPair("ELWYNN_FOREST", MapZone.Elwynn);
                m_zones.AddPair("EVERSONG_WOODS", MapZone.EversongWoods);
                m_zones.AddPair("GHOSTLANDS", MapZone.Ghostlands);
                m_zones.AddPair("HILLSBRAD_FOOTHILLS", MapZone.Hilsbrad);
                m_zones.AddPair("HINTERLANDS", MapZone.Hinterlands);
                m_zones.AddPair("IRONFORGE", MapZone.Ironforge);
                m_zones.AddPair("LOCH_MODAN", MapZone.LochModan);
                m_zones.AddPair("REDRIDGE_MOUNTAINS", MapZone.Redridge);
                m_zones.AddPair("SEARING_GORGE", MapZone.SearingGorge);
                m_zones.AddPair("SILVERMOON", MapZone.Silvermoon);
                m_zones.AddPair("SILVERPINE_FOREST", MapZone.Silverpine);
                m_zones.AddPair("STORMWIND", MapZone.Stormwind);
                m_zones.AddPair("STRANGLETHORN_VALE", MapZone.Stranglethorn);
                m_zones.AddPair("SWAMP_OF_SORROWS", MapZone.SwampOfSorrows);
                m_zones.AddPair("TIRISFAL_GLADES", MapZone.Tirisfal);
                m_zones.AddPair("UNDERCITY", MapZone.Undercity);
                m_zones.AddPair("WESTERN_PLAGUELANDS", MapZone.WesternPlaguelands);
                m_zones.AddPair("WESTFALL", MapZone.Westfall);
                m_zones.AddPair("WETLANDS", MapZone.Wetlands);
                //Outlands
                m_zones.AddPair("BLADES_EDGE_MOUNTAINS", MapZone.BladesEdge);
                m_zones.AddPair("HELLFIRE_PENINSULA", MapZone.Hellfire);
                m_zones.AddPair("NAGRAND", MapZone.Nagrand);
                m_zones.AddPair("NETHERSTORM", MapZone.Netherstorm);
                m_zones.AddPair("SHADOWMOON_VALLEY", MapZone.Shadowmoon);
                m_zones.AddPair("SHATTRATH", MapZone.Shattrath);
                m_zones.AddPair("TEROKKAR_FOREST", MapZone.Terokkar);
                m_zones.AddPair("ZANGARMARSH", MapZone.Zangarmarsh);
            }

            /// <summary>
            /// A static method to translate a string into an enum using the dictionary.
            /// </summary>
            /// <param name="areaName"></param>
            /// <returns>The enum for the zone, or MapZone.Unknown</returns>
            public static MapZone GetZone(string areaName)
            {
                MapZone result;
                if (!m_zones.GetSecond(areaName, out result))
                {
                    result = MapZone.Unknown;
                }
                return result;
            }

            /// <summary>
            /// A static method to translate an enum into a string using the dictionary.
            /// </summary>
            /// <param name="areaName"></param>
            /// <returns>The enum for the zone, or MapZone.Unknown</returns>
            public static string GetAreaName(MapZone zone)
            {
                string result;
                if (!m_zones.GetFirst(zone, out result))
                {
                    result = "UNKNOWN";
                }
                return result;
            }
        }
    }
}
